import {Request, Response} from 'express';

function getFakeCaptcha(req: Request, res: Response) {
  return res.json('captcha-xxx');
}

export default {
 
  'GET /api/customer/1001': {
    customerInfo: {
      name: 'John Goodenough',
      avatar: 'http://5b0988e595225.cdn.sohucs.com/images/20171012/70c680bed8104b3384a1b83626f30bc7.jpeg',
      chineseName: '约翰·古迪纳',
      birthday:'1922-07-25',
      langPreferences:'English',
      gender: 'M',
      passport:'C150239238',
      residentialStatus:'US Residents',
      rmCode:'IM-GJ',
      nationality:'American',
      currentGameTerminal:'Current play at TC-1008',
      currentHotelStay:'Current stay at Love Story Hotel',
      email: 'antdesign@alipay.com',
      signature: '海纳百川，有容乃大',
      title: '交互专家',
      group: '蚂蚁金服－某某某事业群－某某平台部－某某技术部－UED',
      address: '西湖区工专路 77 号',
      phone: '0752-268888888',
    }
  },
  'GET /api/customer/1002': {
    customerInfo: {
      name: 'Stanley Whittingham',
      avatar: 'http://www.cas.cn/zt/sszt/2019nobelprize/2019hxj/2019hjz/201910/W020191010559694710730.jpg',
      chineseName: '斯坦利·惠廷厄姆',
      birthday:'1922-07-25',
      langPreferences:'English',
      gender: 'M',
      passport:'C150239238',
      residentialStatus:'US Residents',
      rmCode:'IM-GJ',
      nationality:'American',
      currentGameTerminal:'Current play at TC-1008',
      currentHotelStay:'Current stay at Love Story Hotel',
      email: 'antdesign@alipay.com',
      signature: '海纳百川，有容乃大',
      title: '交互专家',
      group: '蚂蚁金服－某某某事业群－某某平台部－某某技术部－UED',
      address: '西湖区工专路 77 号',
      phone: '0752-268888888',
    }
  },
  'GET /api/customer/1003': {
    customerInfo: {
      name: 'Akira Yoshino',
      avatar: 'https://gss1.bdstatic.com/-vo3dSag_xI4khGkpoWK1HF6hhy/baike/c0%3Dbaike116%2C5%2C5%2C116%2C38/sign=5c58a44c78ec54e755e1124cd851f035/9825bc315c6034a823b891f3c81349540923766d.jpg',
      chineseName: '吉野彰',
      birthday:'1922-07-25',
      langPreferences:'English',
      gender: 'M',
      passport:'C150239238',
      residentialStatus:'US Residents',
      rmCode:'IM-GJ',
      nationality:'American',
      currentGameTerminal:'Current play at TC-1008',
      currentHotelStay:'Current stay at Love Story Hotel',
      email: 'antdesign@alipay.com',
      signature: '海纳百川，有容乃大',
      title: '交互专家',
      group: '蚂蚁金服－某某某事业群－某某平台部－某某技术部－UED',
      address: '西湖区工专路 77 号',
      phone: '0752-268888888',
    }
  },
  // GET POST 可省略
  'GET /api/customer/users': [
    {
      key: '1',
      name: 'John Brown',
      age: 32,
      address: 'New York No. 1 Lake Park',
    },
    {
      key: '2',
      name: 'Jim Green',
      age: 42,
      address: 'London No. 1 Lake Park',
    },
    {
      key: '3',
      name: 'Joe Black',
      age: 32,
      address: 'Sidney No. 1 Lake Park',
    },
  ],
  'POST /api/customer/login/account': (req: Request, res: Response) => {
    const {password, userName, type} = req.body;
    if (password === 'ant.design' && userName === 'admin') {
      res.send({
        status: 'ok',
        type,
        currentAuthority: 'admin',
      });
      return;
    }
    if (password === 'ant.design' && userName === 'user') {
      res.send({
        status: 'ok',
        type,
        currentAuthority: 'user',
      });
      return;
    }
    res.send({
      status: 'error',
      type,
      currentAuthority: 'guest',
    });
  },
  'POST /api/customer/register': (req: Request, res: Response) => {
    res.send({status: 'ok', currentAuthority: 'user'});
  },
  'GET /api/customer/500': (req: Request, res: Response) => {
    res.status(500).send({
      timestamp: 1513932555104,
      status: 500,
      error: 'error',
      message: 'error',
      path: '/base/category/list',
    });
  },
  'GET /api/customer/404': (req: Request, res: Response) => {
    res.status(404).send({
      timestamp: 1513932643431,
      status: 404,
      error: 'Not Found',
      message: 'No message available',
      path: '/base/category/list/2121212',
    });
  },
  'GET /api/customer/403': (req: Request, res: Response) => {
    res.status(403).send({
      timestamp: 1513932555104,
      status: 403,
      error: 'Unauthorized',
      message: 'Unauthorized',
      path: '/base/category/list',
    });
  },
  'GET /api/customer/401': (req: Request, res: Response) => {
    res.status(401).send({
      timestamp: 1513932555104,
      status: 401,
      error: 'Unauthorized',
      message: 'Unauthorized',
      path: '/base/category/list',
    });
  },

  'GET  /api/customer/login/captcha': getFakeCaptcha,
};
